libutil: Add a helper for O_TMPFILE + mmap()
authorColin Walters <walters@verbum.org>
Wed, 28 Jun 2017 17:41:52 +0000 (13:41 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Thu, 29 Jun 2017 14:46:18 +0000 (14:46 +0000)
commit6f2ea23e8a96cf7dddadf0eae1b4f831db88d67f
treef3c472ab9e35f2029738d152f52f2763ceed878f
parent9d10bdfd0d90d6ea6a31bbd89243f3b23ff51e8d
libutil: Add a helper for O_TMPFILE + mmap()

I added `glnx_open_anonymous_tmpfile()`, but then later noticed
that the usage of this was really to be combined with `mmap()`,
and we had two versions of that in the delta code.  Add a helper.

(Bigger picture...how is this different from glibc's "mmap() of /dev/zero"
 approach for large chunks? One advantage is the storage can be "swapped" to
 `/var/tmp`, but still deleted automatically, rather than requiring swap space)

Closes: #973
Approved by: jlebon
src/libostree/ostree-repo-static-delta-compilation.c
src/libostree/ostree-repo-static-delta-core.c
src/libotutil/ot-fs-utils.c
src/libotutil/ot-fs-utils.h